import {
    NavigationGuardNext,
    RouteLocationNormalized,
    RouteRecordRaw,
    createRouter,
    createWebHistory,
  } from "vue-router";
  
  // 配置页面路由
  const routes: Array<RouteRecordRaw> = [
    {
        path:"/",
        name:"index",
        redirect: "/login",
        children:[
          {
            // 增加一个路由
            path:"/login",
            name:"login",
            // 指向页面
            component: () => import("@/login.vue"),
          },{
          // 增加一个路由
          path:"/newpage",
          name:"newpage",
          // 指向页面
          component: () => import("@/views/new-page.vue")
        },
        ]
    }
  ];
  const router = createRouter({
    history: createWebHistory(process.env.BASE_URL),
    routes,
  });
  router.beforeEach(
    (
      to: RouteLocationNormalized,
      from: RouteLocationNormalized,
      next: NavigationGuardNext
    ) => {
      next();
    }
  );
  export default router;
  